home *** CD-ROM | disk | FTP | other *** search
- Path: solon.com!not-for-mail
- From: James Kanze US/ESC 60/3/141 #40763 <kanze@lts.sel.alcatel.de>
- Newsgroups: comp.lang.c,comp.lang.c.moderated
- Subject: Re: const pointer confusion...
- Date: 26 Mar 1996 18:58:44 -0600
- Organization: Digital Solutions
- Sender: clc@solutions.solon.com
- Approved: clc@solutions.solon.com
- Message-ID: <4ja3s4$par@solutions.solon.com>
- References: <4j06gm$7oa@solutions.solon.com> <4j41io$nma@solutions.solon.com> <4j6389$3iq@solutions.solon.com>
- NNTP-Posting-Host: solutions.solon.com
-
- In article <4j6389$3iq@solutions.solon.com> c2a192@ugrad.cs.ubc.ca
- (Kazimir Kylheku) writes:
-
- |> In article <4j41io$nma@solutions.solon.com>,
- |> Huayong Yang <yang@math.umass.edu> wrote:
- |> >
- |> >const int *p and int const *p are the same: a pointer to const integer;
- |> >int * const p means a const pointer to integer. A little program to
- |> >verify it:
-
- |> This is true. The grammar of the C language allows type specifiers, type
- |> qualifers and storage class specifiers to appear in any order in the syntactic
- |> unit ``declaration-specifiers''. Thus,
-
- |> const int i;
-
- |> and
- |> int const i;
-
- |> are essentially the same declaration. It's probably good style to not use any
- |> old arbitrary order, but stick to putting the storage class first (if any),
- |> followed by the const or volatile qualifier, followed by the type.
-
- I agree about not using any old arbitrary order, but the cv-qualifiers
- should definitly come *after* what they modify. It is only in the
- declaration-specifier that you have any freedom. In the declarator,
- the cv-qualifier *must* follow what it modifies. So why do it any
- differently here.
-
- --
- James Kanze Tel.: (+33) 88 14 49 00 email: kanze@gabi-soft.fr
- GABI Software, Sarl., 8 rue des Francs-Bourgeois, F-67000 Strasbourg, France
- Conseils, Θtudes et rΘalisations en logiciel orientΘ objet --
- -- A la recherche d'une activitΘ dans une region francophone
-